package org.ims.inv.service.flow;

import org.ims.inv.model.flow.ModelFlowBase;
import org.ims.inv.model.flow.material.ModelFlowMaterial;

import cn.trymore.core.exception.ServiceException;

/**
 * Service: 工作流
 * 
 * @author Jeccy.Zhao
 *
 */
public interface ServiceWorkFlow
{
	/**
	 * Activates specified flow definition.
	 * 
	 * @param defId
	 * @throws ServiceException
	 */
	void activateFlowDefinition (String defId) throws ServiceException;
	
	/**
	 * Drops specified flow definition.
	 * 
	 * @param defId
	 * @throws ServiceException
	 */
	void dropFlowDefinition (String defId) throws ServiceException;
	
	/**
	 * Obtains available sequences with the specified entity id
	 * 
	 * @param entityId
	 * @param source
	 * @throws ServiceException
	 */
	int getAvailableSeqs (String entityId, String source) throws ServiceException;
	
	/**
	 * Obtains entity with sequence
	 * 
	 * @param sequence
	 * @param source
	 * @param entity
	 * @return
	 * @throws ServiceException
	 */
	ModelFlowBase getBySequence (Integer sequence, String source, ModelFlowBase entity) throws ServiceException;
	
	/**
	 * Refreshes the sequence mapping
	 * 
	 * @throws ServiceException
	 */
	void refreshFlowSequenceMap (String defId) throws ServiceException;
	
	/**
	 * Refreshes material sequence 
	 * 
	 * @param parent
	 * @throws ServiceException
	 */
	void refreshMaterialSequenceMap (ModelFlowMaterial parent) throws ServiceException;
	
	/**
	 * Entry item for flow definition service
	 * 
	 * @return
	 */
	ServiceFlowDefinition getServiceFlowDefinition();
	
	/**
	 * Entry item for flow template service
	 * 
	 * @return
	 */
	ServiceFlowTemplate getServiceFlowTemplate();
	
	/**
	 * Entry item for flow material service
	 * 
	 * @return
	 */
	ServiceFlowMaterial getServiceFlowMaterial();
	
	/**
	 * Entry item for flow conference service
	 * 
	 * @return
	 */
	ServiceFlowConfer getServiceFlowConfer();
	
}
